/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a6cf7;
    --secondary-color: #f76e6c;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --light-gray: #e9ecef;
    --dark-gray: #6c757d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
    
    /* 移动端适配单位 */
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 60px; /* 底部导航的空间 */
}

.hidden {
    display: none !important;
}

/* 头部样式 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--light-gray);
    border-radius: 20px;
    padding: 0.5rem;
    flex: 1;
    max-width: 280px;
    margin-left: 1rem;
}

.search-bar input {
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    flex: 1;
    outline: none;
    font-size: 0.9rem;
}

.search-bar button {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 底部导航 */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    padding: 0.75rem 0;
    z-index: 10;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--dark-gray);
    text-decoration: none;
    font-size: 0.8rem;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.nav-item.active {
    color: var(--primary-color);
}

/* 主容器 */
.container {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 壁纸筛选器 */
.wallpaper-filters {
    display: flex;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    gap: 0.5rem;
    scrollbar-width: none; /* Firefox */
}

.wallpaper-filters::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.filter-btn {
    background: white;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    font-size: 0.9rem;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 壁纸网格 */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.wallpaper-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: white;
    position: relative;
    transition: var(--transition);
    height: 100%;
    transform: translateZ(0); /* 性能优化 */
}

.wallpaper-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* 卡片删除动画 */
.wallpaper-card.removing {
    transform: translateX(100%);
    opacity: 0;
}

.wallpaper-img {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: cover;
    display: block;
    background-color: var(--light-gray);
}

.wallpaper-info {
    padding: 0.75rem;
}

.wallpaper-category {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
}

.wallpaper-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.action-icon {
    /*display: flex;*/
    /*align-items: center;*/
    /*justify-content: center;*/
    cursor: pointer;
    transition: var(--transition);
}


.action-icon.favorite.active {
    /*color: var(--secondary-color);*/
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    color: var(--dark-gray);
    font-size: 0.9rem;
}

/* 加载动画 */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 分类页样式 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.category-card {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1/1;
    box-shadow: var(--shadow);
}

.category-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
}

.category-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.category-count {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 详情页样式 */
.detail-page {
    background: black;
    color: white;
    min-height: 100vh;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.action-btn.active {
    background: var(--secondary-color);
    color: white;
}

.wallpaper-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
}

.wallpaper-detail img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

.wallpaper-info {
    background: white;
    color: var(--text-color);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem;
    margin-top: -2rem;
    position: relative;
    z-index: 5;
}

.wallpaper-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.wallpaper-description {
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.info-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.info-item {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 0.8rem;
    color: var(--dark-gray);
    margin-bottom: 0.25rem;
}

.value {
    font-weight: 500;
}

.tags-section, .related-section {
    margin-bottom: 1.5rem;
}

.tags-section h3, .related-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--light-gray);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.related-wallpapers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.related-card {
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 9/16;
}

.related-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 4rem;
    color: var(--light-gray);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
}

.btn {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn:hover {
    opacity: 0.9;
}

/* 响应式调整 */
@media (min-width: 768px) {
    .wallpaper-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .related-wallpapers {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* 图片懒加载占位符 */
.lazy-image {
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%;
    animation: shine 1.5s linear infinite;
}

@keyframes shine {
    to {
        background-position-x: -200%;
    }
}

/* Toast通知 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
    z-index: 100;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 错误信息 */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.error-message i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.error-message p {
    margin-bottom: 1.5rem;
    color: var(--dark-gray);
}

/* 平滑过渡效果 */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.page-transition.show {
    opacity: 1;
    transform: translateY(0);
}

/* 下拉刷新指示器 */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    transform: translateY(-100%);
    transition: transform 0.3s;
    z-index: 9;
}

.pull-refresh-indicator.visible {
    transform: translateY(0);
}

/* 点击波纹效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple:after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active:after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* 小型返回按钮 */
.header-left {
    display: flex;
    align-items: center;
}

.back-btn-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--light-gray);
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 1rem;
}

.category-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
} 